import $axios from "@/network";

/**
 * {账号登陆}
 *
 * @author: 宋康
 * @date: 2022/10/5 17:10
 */
export const login = (username, password) => {
  return $axios({
    method: 'POST',
    url: '/uaa/oauth/token',
    headers: {
      Authorization: process.env.VUE_APP_API_AUTHENTICATION
    },
    data: {
      "grant_type": "password",
      "username": username,
      "password": password
    }
  })
}

/**
 * {重新登录}
 *
 * @author: 宋康
 * @date: 2023/1/31
 */
export const reLogin = (re) => {
  return $axios({
    method: 'POST',
    url: '/uaa/oauth/token',
    headers: {
      Authorization: process.env.VUE_APP_API_AUTHENTICATION
    },
    data: {
      "grant_type": "refresh_token",
      "refresh_token": re,
    }
  })
}